package vn.edu.saigontech.ncms.web.bookstore;

import vn.edu.saigontech.ncms.util.Checker;
import vn.edu.saigontech.ncms.web.AbstractValidator;

@SuppressWarnings("serial")
public class ValidateTitleAction extends AbstractValidator {
	private String title;
	private Long[] levelIds;

	@Override
	public String check() {
		if (Checker.isEmpty(this.title)) {
			this.sendKeyError("validator.required", "name");
		}
		if (Checker.isNull(this.levelIds)) {
			this.sendKeyError("validator.required", "level");
		}
		return this.toSuccess();
	}

	public String getTitle() {
		return title;
	}

	public void setTitle(String title) {
		this.title = title;
	}

	public Long[] getLevelIds() {
		return levelIds;
	}

	public void setLevelIds(Long[] levelIds) {
		this.levelIds = levelIds;
	}
}
